<table id="notifications" class="generic_datatable table table-striped table-bordered">
  <% if defined? title %>
    <caption><h3><%= title %></h3></caption>
  <% end %>
  <thead>
    <tr>
      <th>Creation Date</th>
      <th>Subject</th>
      <th>Status</th>
      <th>Event</th>
      <th>Departments</th>
      <th>Recipients</th>
      <th>Channels</th>
      <th colspan="1"></th>
    </tr>
  </thead>

  <%# TODO: I need to allow info only Notifications %>
  <tbody>
    <% notifications.each do |notification| %>
      <tr>
        <td><%= notification.created_at.strftime('%a %b %d %k:%M') if notification.created_at %></td> 
        <td><%= link_to truncate(notification.subject, length: 60), notification_path(notification) %></td>
        <td><%= notification.status %></td>
        <td><%= notification.event ? (link_to notification.event.title, notification.event) : 'None' %></td>
        <td><%= notification.departments.map { |d| d.shortname }.join(", ") %></td>
        <td><%= notification.recipients.count %></td>
        <td><%= notification.channels %></td>
        <td><%= table_button_link  'Edit', edit_notification_path(notification) if can? :update, notification %></td>
      </tr>
    <% end %>
  </tbody>
</table>
